<?php

require_once('db/db.php');

$db=new DB;

function check($name){
	if(isset($_REQUEST[$name])){
		return $_REQUEST[$name];
	}
	else{
		die();
	}
}
$id=intval(check('id'));
$desc=check('desc');
$father=intval(check('father'));

$sql = "update `category` set `father`='$father', `desc`='$desc' where `id`=$id";

if(!$db->query($sql)){
	return false;
}

echo json_encode(array(
	'id' => $id,
	'desc' => $desc,
	'father' => $father
));

?>
